//
//  MainTabBarController.swift
//  jiahui
//
//  Created by 3tee on 2024/11/28.
//

import UIKit

class MainTabBarController: UITabBarController {

    var lgoinModel: LoginModel?
    
    convenience init(model: LoginModel) {
        self.init()
        self.lgoinModel = model
        print("传递的loginmodel2 = \(self.lgoinModel)")
    }
    
    override func viewWillAppear(_ animated: Bool) {
        print("传递的loginmodel = \(self.lgoinModel)")
        setupUI()
    }
    
  
    
    override func viewDidLoad() {
        super.viewDidLoad()
        self.navigationItem.hidesBackButton = true
        self.navigationController?.setNavigationBarHidden(false, animated: true)
        // Do any additional setup after loading the view.
    }


    func setupUI() {
        let joinvc = HomeJoinViewController()
        joinvc.loginModel = lgoinModel
        joinvc.tabBarItem.title = "会议"
        joinvc.tabBarItem.image = UIImage(named: "ic_home_off")
        joinvc.tabBarItem.selectedImage = UIImage(named: "ic_home_on")
        //let navJoinvc = UINavigationController(rootViewController: joinvc)
        let storyboard = UIStoryboard(name: "SettingViewController", bundle: .main)
        let setvc = storyboard.instantiateViewController(withIdentifier:"SettingViewController") as! SettingViewController
        setvc.loginModel = lgoinModel
        //let navSetvc = UINavigationController(rootViewController: setvc)

        setvc.tabBarItem.title = "设置"
        setvc.tabBarItem.image = UIImage(named: "ic_setting_off")
        setvc.tabBarItem.selectedImage = UIImage(named: "ic_setting_on")
        setViewControllers([joinvc,setvc], animated: true)
    }

    
    
}
